﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Proxies.Controller
{
    [ApiController]
    public class ControllerFile : ControllerBase
    {
        private IHttpContextAccessor web;

        public ControllerFile(IHttpContextAccessor accessor)
        {
            web = accessor;
        }

        

        /// <summary>
        /// 访问需要代理下载的url
        /// </summary>
        /// <returns></returns>
        [Route("error/404")]
        public IActionResult Error404()
        {
            string url = web.HttpContext.Request.Headers["url"].ToString();
            string host = web.HttpContext.Request.Headers["host"].ToString();
            if(host.IndexOf("mojang") == -1 && host.IndexOf("minecraft.net") == -1)
            {
                return Content("请求不在业务范围");
            }

            return Content("访问成功");
        }


    }
}
